import org.junit.Test;

import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * Created by asd47 on 2017/6/19.
 */
public class ShortToInt{
    @Test
    public void calculation() throws InterruptedException {
        Lock lock = new ReentrantLock();
/*        double s1 = 1.11;
        s1 = s1 + 1;
        System.out.println(s1);
        String s = null;
        s.length();
        int[] a = {1,2,3};
        int b = a.length;
        HashMap<String,String> hashMap = new HashMap<String, String>();
        Set set = new HashSet<String>();*/
        CompareTest compareTest1 = new CompareTest();
        try {
            compareTest1.call();
        } catch (Exception e) {
            e.printStackTrace();
        }
        lock.lock();
        CompareTest compareTest2 = new CompareTest();
        Thread thread1 = new Thread(compareTest1);
        Thread thread2 = new Thread(compareTest2);
        thread1.start();
        lock.tryLock();
        /*System.out.println(compareTest1.compare(compareTest1,compareTest2));*/
    }



    class CompareTest implements Callable,Runnable{
        int name;

        public int getName() {
            return name;
        }

        public void setName(int name) {
            this.name = name;
        }

        public Object call() throws Exception {
            String string = "YES";
            return string;
        }

        public void run() {
            this.setName(3);
        }
    }

}
